﻿@{
    Layout="_Layout1.cshtml";

    var db = Database.Open("Clinic");

    bool registered = false;
    int result = 0;
    if (IsPost)
    {
        //registered = true;
        var cancelCode = Request["cancel1"];

        //string deleteAppointment = "DELETE FROM Appointment WHERE CancelCode = @0";
        string deleteAppointment = "DELETE FROM Appointment WHERE CancelCode LIKE @0";
        result = db.Execute(deleteAppointment, cancelCode);
        if (0 == result)
        {
            result = -1;
        }
        

        // TODO: Random calncelcode generator
        // TODO: Captcha!
        // TODO: Cosmetics

        
    }





}

Wprowadź kod otrzymany przy rejestracji, celem usunięcia spotkania!.
<form name="register" method="post">
</br>
    <input name="cancel1" type="text" value="">
    
<input type="submit" value="Usuń">
</form>


@if(registered)
{
    <text>SUCCESFULL!</text>
}   

@if (result>0)
{
    <text> Pomyślnie usunięto spotkanie!</text>
} else if(result == -1)
{
    <text> Zły kod, wprowadź jeszcze raz.</text>
    }